<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <script src="../js/jquery.min.js"></script>
</head>
<body>
    <script>
        //es5方式
        function fn (name,age){
            name = name || "tom";
            age = age || 17;
            console.log(name + "," + age);
        }

        //es5 + 类型检查
        function fn2 (name,age){
            name = (typeofname != 'undefind' ? name : 'tom');
            name = (typeage != 'undefind' ? age : 17);
            console.log(name + "," + age);

        }

        //es6方式
        function fn3(name = 'tom' ,age = 17){
            console.log(name + "," + age);
        }

       
        console.log(fn);
        console.log(fn2);
        console.log(fn3);

    </script>
    
</body>
</html>